{extend name="pc/admin/layout"/}
{block name="main"}
   <div class="g-1400 g-container" id="pjax-container">
        
<div class="bg-bai b rx3" id="vue-page">
<form id="form-config">
    <div class="t-v t-t">
        <div class="c-sidebar c-sidebar-h pb5 br">
            <div class="c-sidebar-title t-v hui bb">支付相关设置</div>
            <ul class="c-nav click-nav">
                <li class="active"><a href="{:url('pc/admin',['act'=>'pay','s'=>'e'])}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>支付配置</div>
                </a></li>
				<li><a href="{:url('pc/admin',['act'=>'pay','s'=>'o'])}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>订单列表</div>
                </a></li>
				<li><a href="{:url('pc/admin',['act'=>'pay','s'=>'vip'])}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>VIP价格</div>
                </a></li>
				<li><a href="{:url('pc/admin',['act'=>'pay','s'=>'daili'])}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>代理价格</div>
                </a></li>
				<li><a href="{:url('pc/admin',['act'=>'pay','s'=>'peie'])}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>配额价格</div>
                </a></li>
				<li><a href="{:url('pc/admin',['act'=>'pay','s'=>'fz'])}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>分站价格</div>
                </a></li>
            </ul>
        </div>
<div class="c-content bl">
            <div class="col-6 fl br" style="min-height:420px;">
                <div class="g-title t-v pl4 bb">
                    <div class="col-12 h t-v bold">支付方式开关</div>
                </div>
				<div class="p5 o-h">
        <div class="pt1 pb3 in-text">
            <dt class="bold bb pr2 lan">支付宝</dt>
            <dd><select class="form w h8 bb" name="is_alipay" default="{:config('sys_is_alipay')}">
			<option value="0">关闭</option>
			<option value="1" {if condition="config('sys_is_alipay') eq 1" }selected {/if}>开启</option>
			</select></dd>
        </div>
		<div class="pt1 pb3 in-text">
            <dt class="bold bb pr2 lan">QQ支付</dt>
            <dd><select class="form w h8 bb" name="is_qqpay" default="{:config('sys_is_qqpay')}">
			<option value="0">关闭</option>
			<option value="1" {if condition="config('sys_is_qqpay') eq 1" }selected {/if}>开启</option>
			</select></dd>
        </div>
		<div class="pt1 pb3 in-text">
            <dt class="bold bb pr2 lan">微信支付</dt>
            <dd><select class="form w h8 bb" name="is_wxpay" default="{:config('sys_is_wxpay')}">
			<option value="0">关闭</option>
			<option value="1" {if condition="config('sys_is_wxpay') eq 1" }selected {/if}>开启</option>
			</select></dd>
        </div>
		</div>
            </div>
            <div class="col-6 fl bl" style="margin-left:-1px;">
                <div class="g-title t-v pl4 bb">
                    <div class="col-12 h t-v bold">支付商户配置</div>
                </div>
				<div class="p5 o-h">
				<div class="pt1 pb3 in-text">
					<dt class="bold bb pr2 lan">支付接口</dt>
					<dd><select class="form w h8 bb" name="is_pay" default="{:config('sys_is_pay')}">
						<option value="1" {if condition="config('sys_is_pay') eq 1" }selected {/if}>码支付</option>
                        <option value="2" {if condition="config('sys_is_pay') eq 2" }selected {/if}>易支付</option>
					</select></dd>
				</div>
				<div id="show_pay1" style="display: none">
					<div class="pt1 pb3 in-text">
							<dt class="bold bb pr2 lan">码支付商户ID</dt>
							<dd><input class="form w h8 bb" type="number" name="codepay_id" placeholder="输入码支付的商户ID" value="{:config('sys_codepay_id')}"></dd>
					</div>
					<div class="pt1 pb3 in-text">
							<dt class="bold bb pr2 lan">码支付商户ID</dt>
							<dd><input class="form w h8 bb" type="text" name="codepay_key" placeholder="输入码支付的商户密钥" value="{:config('sys_codepay_key')}"></dd>
					</div>
				</div>
				<div id="show_pay2" style="display: none">
					<div class="pt1 pb3 in-text">
							<dt class="bold bb pr2 lan">易支付API地址</dt>
							<dd><input class="form w h8 bb" type="url" name="epay_url" placeholder="输入易支付的API地址" value="{:config('sys_epay_url')}"></dd>
					</div>
					<div class="pt1 pb3 in-text">
						<dt class="ml4 f3 hui"><font class="hong">推荐易支付平台:<a href="https://www.weizhipay.cn/"> 微支聚合支付</a><a href="https://pay.ruomiu.com/"> 若缪易支付</a></dt>
					</div>
					<div class="pt1 pb3 in-text">
							<dt class="bold bb pr2 lan">易支付商户ID</dt>
							<dd><input class="form w h8 bb" type="number" name="epay_id" placeholder="输入易支付的商户ID" value="{:config('sys_epay_id')}"></dd>
					</div>
					<div class="pt1 pb3 in-text">
							<dt class="bold bb pr2 lan">易支付商户Key</dt>
							<dd><input class="form w h8 bb" name="epay_key" placeholder="输入易支付的商户密钥" value="{:config('sys_epay_key')}"></dd>
					</div>
                </div>
		</div>
            </div>
        </div>
</div>
</form>
<div class="c-pagination o-h t-v">
        <div class="c-sidebar"></div>
        <div class="c-content h11 o-h g-btn t-v bt bl">
            <div class="col-12 h t-v f3 hui pl5 pr5 t-c">
			<button type="button" class="btn btn-qing btn-md w22 rx1" @click="saveConfig()">保 存 设 置</button></div>
        </div>
    </div>
</div>

    </div>
   {/block}
   {block name='foot'}
		<script>
        new Vue({
            el: '#vue-page',
            methods: {
                saveConfig: function () {
                    app.ajax("{:url('admin_ajax/config')}", $("#form-config").serialize(), function (data) {
                        if (data.code === 0) {
                            x.msg(data.message)
                        } else {
                            x.msg(data.message)
                        }
                    })
                }
            }
        });
		$("select[name='is_pay']").change(function () {
			if ($(this).val() == 1) {
				$("#show_pay1").css("display", "inherit");
				$("#show_pay2").css("display", "none");
			} else {
				$("#show_pay2").css("display", "inherit");
				$("#show_pay1").css("display", "none");
			}
		});
		var ispay = "{:config('sys_is_pay')}";
		if (ispay == '') {
			$("#show_pay1").css("display", "inherit");
			$("#show_pay2").css("display", "none");
		}else if (ispay == 1) {
			$("#show_pay1").css("display", "inherit");
			$("#show_pay2").css("display", "none");
		} else {
			$("#show_pay2").css("display", "inherit");
			$("#show_pay1").css("display", "none");
		}
    </script>
    {/block}